﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Operator.aspx.cs" Inherits="syc.Admin.Operator" %>
<html>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">操作员管理</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <asp:Button ID="Button_New" runat="server" Text="新  增" CssClass="button" 
            onclick="Button_New_Click" UseSubmitBehavior="False" />
            
        <asp:Button ID="Button3" runat="server" Text="用户权限" CssClass="button" 
            UseSubmitBehavior="False" onclick="Button3_Click"/>
            
        <asp:Button ID="Button_Delete" runat="server" Text="删 除" CssClass="button" 
            UseSubmitBehavior="False" onclick="Button_Delete_Click" />
            
        <asp:Button ID="Button4" runat="server" Text="用户查询" CssClass="button" 
            UseSubmitBehavior="False" onclick="Button4_Click" />  
            
    </asp:Panel>
    <asp:Panel ID="Panel4" runat="server" CssClass="panel" Visible="False">
        工号：<asp:TextBox ID="GongHao" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>
        姓名：<asp:TextBox ID="XingMing" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>
        <asp:Button ID="Button_Query"
            runat="server" Text="查 询" CssClass="smallbutton" UseSubmitBehavior="true" 
            onclick="Button_Query_Click"  />
        <asp:Button ID="Button6"
            runat="server" Text="取 消" CssClass="smallbutton" UseSubmitBehavior="true" onclick="Button6_Click" 
            />
    </asp:Panel>
    
    
    <asp:Panel ID="Panel2" runat="server" CssClass="panel" Visible="False">
        <table style="width: 100%">
            <tr>
                <td width=400>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                        UpdateCommand="Update [操作员] set [姓名]=@姓名 where [工号]=@工号"
                        InsertCommand="insert into [操作员]([工号],[姓名])values(@工号,@姓名)" 
                        ></asp:SqlDataSource>
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                        DataSourceID="SqlDataSource1" Height="50px" Width="450px" 
                        DataKeyNames="工号" DefaultMode="Edit" GridLines="None">
                        <Fields>
                           <asp:TemplateField HeaderText="工号*：" SortExpression="工号">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("工号") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="姓名*：" SortExpression="姓名">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("姓名") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                           

                        </Fields>
                    </asp:DetailsView>
                </td>
                <td valign="top"><br />
                    <asp:Button ID="Button_Save" runat="server" Text="保  存" CssClass="button" 
                        onclick="Button_Save_Click" />
                    <asp:Button ID="Button_Cancel" runat="server" Text="取  消" CssClass="button" onclick="Button_Cancel_Click" UseSubmitBehavior="False"  />
                    <div class="prompt">
                    标有 <span class="required">*</span> 表示必须填写
                    </div>
                </td>

            </tr>

        </table>

    </asp:Panel>
    
    
    <asp:Panel ID="Panel3" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
    
    
    
    
    
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#d0d0d0">
	            <tr>
		            <td class="grid-title">操作员</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
                            DeleteCommand="DELETE FROM [操作员] WHERE [工号]=@工号"></asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="工号" 
                            DataSourceID="SqlDataSource2" PageSize="20"
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                            UseAccessibleHeader="False" ondatabinding="GridView1_DataBinding" >
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                            
                                <asp:TemplateField HeaderText="">
                                    <ItemTemplate>
                                        <asp:Button ID="Button5" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                        <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>
                                 
                                <asp:TemplateField HeaderText="工号" SortExpression="工号">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("工号") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="160px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="姓名" SortExpression="姓名">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("姓名") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="160px" />
                                </asp:TemplateField>
                            

                                <asp:TemplateField HeaderText="操作" ShowHeader="true" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" ItemStyle-Width="160" ItemStyle-HorizontalAlign="Center" Visible="false">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CommandName='<%# Eval("工号") %>' 
                                            Text="编辑" onclick="Button1_Click" CssClass="smallbutton" />
                                        <asp:Button ID="Button2" runat="server" CommandName='<%# Eval("工号") %>' 
                                            Text="删除" onclick="Button2_Click" CssClass="smallbutton" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <SelectedRowStyle CssClass="grid-row-selected" />
                        </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server" Text="1"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = function() { this.firstChild.firstChild.click(); };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
